package org.springboot.szsrcb.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springboot.szsrcb.entity.Req_base_info;
import org.springboot.szsrcb.entity.Req_bill;
import org.springboot.szsrcb.entity.Req_workload_info;
import org.springboot.szsrcb.entity.Test_base_info;
import org.springboot.szsrcb.entity.Test_bill;
import org.springboot.szsrcb.entity.Test_testing_info;
import org.springboot.szsrcb.entity.Test_work_log;
import org.springboot.szsrcb.srvice.Req_bill_Service;
import org.springboot.szsrcb.srvice.Test_bill_Service;
import org.springboot.szsrcb.srvice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestRestController_Export {

	private static final Logger logger = LoggerFactory.getLogger(TestRestController_Export.class);

	@Autowired
	private Test_bill_Service test_bill_Service;
	
	@Autowired
	private Req_bill_Service req_bill_Service;
	
	@Autowired
	private UserService userService;
	
	
	@RequestMapping(value = "/test_info_collect_grid", method = { RequestMethod.GET })
	public String test_info_collect_grid(HttpServletRequest request) {
		logger.info("access /test/test_info_collect_grid");		
	
		String s_tmp=trans_2_json_test_info_collect_grid();
		logger.info("trans_2_json_test_info_collect_grid :" + s_tmp);
		return s_tmp;	
		
	}
	
	private String trans_2_json_test_info_collect_grid() {
		// TODO Auto-generated method stubasf
		List<Test_bill> all_test_list=test_bill_Service.search_all_test();
//		String test="{rows:[{id:1,data:['1','2']}]}";
//		return test;
		if(all_test_list!=null){
				String r_start="{rows:[";		
				String r_end="]}";
				String r_content="";
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
				int count_value=0;
				for (Test_bill test_bill : all_test_list) {
					String req_id=String.valueOf(test_bill.getReq_id());
					String test_id=String.valueOf(test_bill.getId());
					Req_bill req_bill=req_bill_Service.req_bill_search_by_id(req_id);
					Req_base_info req_base_info=req_bill_Service.search_req_base_info(req_id);
					count_value=count_value+1;
					String tmp_start="{ id:"+(count_value)+",data:[";
					String tmp_end="]}";
					String tmp_content="";
					if(count_value < all_test_list.size()){
						tmp_end=tmp_end+",";
					}
										
					//ID
					tmp_content="'"+test_bill.getId()+"',";  
					//String tmp_content="";
					//项目名称
					tmp_content=tmp_content+"'"+req_bill.getReq_bill_no()+" "+req_bill.getReq_title()+"',";

					Test_base_info test_base_inf= test_bill_Service.search_a_test_base_info_by_testid(String.valueOf(test_bill.getId()));
					if (test_base_inf != null) {
						//已分配 已完成 状态
						
						String str_reporter="";
						String str_role="";
						String status1="已接收";
						String status2="已分配";
						String status3="已完成";
						String get_test_status=test_bill.getTest_status();
						if(get_test_status.equals(status1)){
							//项目经理
							str_reporter=userService.find_project_manager();
							str_role="负责人";
						}
						if(get_test_status.equals(status2)||get_test_status.equals(status3)){
							///需求负责人、需求分析人、需求监理人
							str_reporter=test_base_inf.getTest_head()+"/"+test_base_inf.getTest_executor();
							str_role="测试负责人/测试实施人";
						}
						//项目经理
						tmp_content=tmp_content+"'"+test_bill.getTest_technical_director()+"',";
						Test_testing_info  test_testing_info=test_bill_Service.search_a_test_testing_info_by_testid(test_id);
						if(test_testing_info!=null){
						//测试结论
						tmp_content=tmp_content+"'"+test_testing_info.getTest_result()+"',";
						//Req_workload_info obj=req_bill_Service.search_a_req_workload_info(req_id,s_array[i],role);
						//测试组织人
						tmp_content=tmp_content+"'"+test_base_inf.getTest_head()+"',";
						//测试概况
						String test_sum="";
						Date g_start_date=test_testing_info.getTest_start_date();
						Date g_end_date=test_testing_info.getTest_end_date();
						Float g_workload=test_testing_info.getTest_workload();
						test_sum=sdf2.format(g_start_date)+"至"+sdf2.format(g_end_date)+" 共 "+g_workload+" 个工作日";
						tmp_content=tmp_content+"'"+test_sum+"',";
						//严重及以上级别缺陷
						tmp_content=tmp_content+"'"+test_testing_info.getDeffect_critical_count()+"',";
						//一般缺陷
						tmp_content=tmp_content+"'"+test_testing_info.getDeffect_ordinary_count()+"',";
						//其他级别缺陷
						tmp_content=tmp_content+"'"+test_testing_info.getDeffect_other_count()+"',";
						//关联交易/功能						
						tmp_content=tmp_content+"'"+test_testing_info.getRelation_funcation()+"',";
						//渠道
						String channel_tmp="";
						String is_checked="1";
						if (test_testing_info.getTest_channel_is_Teller().equals(is_checked)) {
							channel_tmp=channel_tmp+"Teller";
						}
						if (test_testing_info.getTest_channel_is_Core().equals(is_checked)) {
							channel_tmp=channel_tmp+"/Core";
						}
						if (test_testing_info.getTest_channel_is_ATM().equals(is_checked)) {
							channel_tmp=channel_tmp+"/ATM";
						}
						if (test_testing_info.getTest_channel_is_self_service_terminals().equals(is_checked)) {
							channel_tmp=channel_tmp+"/自助终端";
						}
						if (test_testing_info.getTest_channel_is_Tel_bank().equals(is_checked)) {
							channel_tmp=channel_tmp+"/电话银行";
						}
						if (test_testing_info.getTest_channel_is_Net_bank().equals(is_checked)) {
							channel_tmp=channel_tmp+"/网银";
						}
						if (test_testing_info.getTest_channel_is_Mobile_bank().equals(is_checked)) {
							channel_tmp=channel_tmp+"/手机银行";
						}
						if (test_testing_info.getTest_channel_is_Fill_form_machine().equals(is_checked)) {
							channel_tmp=channel_tmp+"/填单机";
						}
						if (test_testing_info.getTest_channel_is_Other().equals(is_checked)) {
							channel_tmp=channel_tmp+"/其他";
							channel_tmp=channel_tmp+" "+test_testing_info.getTest_channel_other_info();
						}						
						tmp_content=tmp_content+"'"+channel_tmp+"',";
						//类型
						String type_tmp="";
						if (test_testing_info.getTest_type_is_Query().equals(is_checked)) {
							type_tmp=type_tmp+"查询交易";
						}
						if (test_testing_info.getTest_type_is_Maintain().equals(is_checked)) {
							type_tmp=type_tmp+"维护交易";
						}
						if (test_testing_info.getTest_type_is_Finance().equals(is_checked)) {
							type_tmp=type_tmp+"财务交易";
						}
						if (test_testing_info.getTest_type_is_Other().equals(is_checked)) {
							type_tmp=type_tmp+"其他类型";
							type_tmp=type_tmp+" "+test_testing_info.getTest_type_Other_info();
						}						
						tmp_content=tmp_content+"'"+type_tmp+"',";
						//案例覆盖
						String case_tmp="";
						if (test_testing_info.getTest_cover_is_certificate().equals(is_checked)) {
							case_tmp=case_tmp+"凭证状态(";
							if (test_testing_info.getTest_cover_is_certificate_Normal().equals(is_checked)) {
								case_tmp=case_tmp+"正常";
							}
							if (test_testing_info.getTest_cover_is_certificate_Exception().equals(is_checked)) {
								case_tmp=case_tmp+"异常";
							}
							case_tmp=case_tmp+")";
						}
						if (test_testing_info.getTest_cover_is_account().equals(is_checked)) {
							case_tmp=case_tmp+"账户状态(";
							if (test_testing_info.getTest_cover_is_account_Normal().equals(is_checked)) {
								case_tmp=case_tmp+"正常";
							}
							if (test_testing_info.getTest_cover_is_account_Exception().equals(is_checked)) {
								case_tmp=case_tmp+"异常";
							}
							case_tmp=case_tmp+")";
						}
						if (test_testing_info.getTest_cover_is_balance().equals(is_checked)) {
							case_tmp=case_tmp+"余额状态(";
							if (test_testing_info.getTest_cover_is_balance_Normal().equals(is_checked)) {
								case_tmp=case_tmp+"正常";
							}
							if (test_testing_info.getTest_cover_is_balance_Exception().equals(is_checked)) {
								case_tmp=case_tmp+"异常";
							}
							case_tmp=case_tmp+")";
						}
						if (test_testing_info.getTest_cover_is_password().equals(is_checked)) {
							case_tmp=case_tmp+"密码校验(";
							if (test_testing_info.getTest_cover_is_password_Normal().equals(is_checked)) {
								case_tmp=case_tmp+"正常";
							}
							if (test_testing_info.getTest_cover_is_password_Exception().equals(is_checked)) {
								case_tmp=case_tmp+"异常";
							}
							case_tmp=case_tmp+")";
						}
						
						if (test_testing_info.getTest_cover_is_accounting_entry().equals(is_checked)) {
							case_tmp=case_tmp+"/会计分录";							
						}
						if (test_testing_info.getTest_cover_is_limit_management().equals(is_checked)) {
							case_tmp=case_tmp+"/限额管理";							
						}
						if (test_testing_info.getTest_cover_is_business_process().equals(is_checked)) {
							case_tmp=case_tmp+"/业务流程";							
						}
						if (test_testing_info.getTest_cover_is_operate_ui().equals(is_checked)) {
							case_tmp=case_tmp+"/操作界面";							
						}
						if (test_testing_info.getTest_cover_is_batch_check().equals(is_checked)) {
							case_tmp=case_tmp+"/批处理验证";							
						}
						if (test_testing_info.getTest_cover_is_MEMO_check().equals(is_checked)) {
							case_tmp=case_tmp+"/MEMO验证";							
						}
						if (test_testing_info.getTest_cover_is_Authorized_handle().equals(is_checked)) {
							case_tmp=case_tmp+"/授权操作";							
						}
						if (test_testing_info.getTest_cover_is_data_aync().equals(is_checked)) {
							case_tmp=case_tmp+"/数据同步";							
						}
						if (test_testing_info.getTest_cover_is_answer_info().equals(is_checked)) {
							case_tmp=case_tmp+"/应答信息";							
						}
						if (test_testing_info.getTest_cover_is_account_checking().equals(is_checked)) {
							case_tmp=case_tmp+"/对账差错";							
						}
						if (test_testing_info.getTest_cover_is_bill_print().equals(is_checked)) {
							case_tmp=case_tmp+"/清单打印";							
						}
						if (test_testing_info.getTest_cover_is_Electronic_receipt().equals(is_checked)) {
							case_tmp=case_tmp+"/电子回单";							
						}
						if (test_testing_info.getTest_cover_is_opposite_info().equals(is_checked)) {
							case_tmp=case_tmp+"/对手信息";							
						}
						if (test_testing_info.getTest_cover_is_summary_code().equals(is_checked)) {
							case_tmp=case_tmp+"/摘要代码";							
						}
						if (test_testing_info.getTest_cover_is_report_form_info().equals(is_checked)) {
							case_tmp=case_tmp+"/报表信息";							
						}
						if (test_testing_info.getTest_cover_is_SMS().equals(is_checked)) {
							case_tmp=case_tmp+"/短信相关";							
						}
						if (test_testing_info.getTest_cover_is_hardware().equals(is_checked)) {
							case_tmp=case_tmp+"/硬件设备";							
						}
						if (test_testing_info.getTest_cover_is_load_test().equals(is_checked)) {
							case_tmp=case_tmp+"/压力测试";							
						}
						if (test_testing_info.getTest_cover_is_timeout().equals(is_checked)) {
							case_tmp=case_tmp+"/超时处理";							
						}
						if (test_testing_info.getTest_cover_is_exception().equals(is_checked)) {
							case_tmp=case_tmp+"/异常处理";							
						}
						if (test_testing_info.getTest_cover_is_other().equals(is_checked)) {
							case_tmp=case_tmp+"/特殊其他";			
							case_tmp=case_tmp+" "+ test_testing_info.getTest_cover_other_info();
						}						
						
						tmp_content=tmp_content+"'"+case_tmp+"',";
//						其他说明
						tmp_content=tmp_content+"'"+test_testing_info.getOther_remark()+"',";
//						上线申请
						String tmp_Plan_online_date=sdf2.format(test_testing_info.getPlan_online_date());
						tmp_content=tmp_content+"'"+tmp_Plan_online_date+"',";
//						上线申请人
						tmp_content=tmp_content+"'',";
//						上线步骤
						tmp_content=tmp_content+"'"+test_testing_info.getPlan_online_step()+"',";
						
//						应急预案
						tmp_content=tmp_content+"'"+test_testing_info.getContingency_plan()+" "+test_testing_info.getContingency_plan_remark()+"',";
//						跟踪事项/目的
						tmp_content=tmp_content+"'"+test_testing_info.getOnline_trace_info()+"',";
//						跟踪时间
						Date get_Online_trace_start_date=test_testing_info.getOnline_trace_start_date();
						Date get_Online_trace_end_date=test_testing_info.getOnline_trace_end_date();
						test_sum=sdf2.format(get_Online_trace_start_date)+"至"+sdf2.format(get_Online_trace_end_date);
						tmp_content=tmp_content+"'"+test_sum+"',";
//						跟踪人
						tmp_content=tmp_content+"'"+test_testing_info.getOnline_tracer()+"',";
//						注意事项
						String Attention_tmp="";
						if (test_testing_info.getAttention_is_inform_dept_offer().equals(is_checked)) {
							Attention_tmp=Attention_tmp+"通知需求提示部门、提出人";							
						}	
						if (test_testing_info.getAttention_is_business_check().equals(is_checked)) {
							Attention_tmp=Attention_tmp+"、相关业务开展审批已完成";							
						}
						if (test_testing_info.getAttention_is_bank_head_check().equals(is_checked)) {
							
							if (test_testing_info.getAttention_is_bank_head_check_yes().equals(is_checked)) {
								Attention_tmp=Attention_tmp+"、需要行领导审批";
							}else{
								Attention_tmp=Attention_tmp+"、不需要行领导审批";
							}
						}
						if (test_testing_info.getAttention_is_other().equals(is_checked)) {
							Attention_tmp=Attention_tmp+"、其他 "+test_testing_info.getAttention_other_info();
						}
						tmp_content=tmp_content+"'"+Attention_tmp+"'";
						//row info 组装
						tmp_content=tmp_start+tmp_content+tmp_end;		
						r_content=r_content+tmp_content;
						}else{
							//test_testing_info is null
//							测试结论
							tmp_content=tmp_content+"'',";
//							测试组织人
							tmp_content=tmp_content+"'',";
//							测试概况
							tmp_content=tmp_content+"'',";
//							严重及以上级别缺陷
							tmp_content=tmp_content+"'',";
//							一般缺陷
							tmp_content=tmp_content+"'',";
//							其他级别缺陷
							tmp_content=tmp_content+"'',";
//							关联交易/功能
							tmp_content=tmp_content+"'',";
//							渠道
							tmp_content=tmp_content+"'',";
//							类型
							tmp_content=tmp_content+"'',";
//							案例覆盖
							tmp_content=tmp_content+"'',";
//							其他说明
							tmp_content=tmp_content+"'',";
//							上线申请
							tmp_content=tmp_content+"'',";
//							上线申请人
							tmp_content=tmp_content+"'',";
//							上线步骤
							tmp_content=tmp_content+"'',";
//							应急预案
							tmp_content=tmp_content+"'',";
//							跟踪事项/目的
							tmp_content=tmp_content+"'',";
//							跟踪时间
							tmp_content=tmp_content+"'',";
//							跟踪人
							tmp_content=tmp_content+"'',";
//							注意事项
							tmp_content=tmp_content+"''";
							
							tmp_content=tmp_start+tmp_content+tmp_end;		
							r_content=r_content+tmp_content;
						}
					}else{
						//已接收，未分配状态时
//						送测清单编号						
						//ID
						tmp_content="'"+test_bill.getId()+"',";  
						//项目名称
						tmp_content=tmp_content+"'"+req_bill.getReq_bill_no()+" "+req_bill.getReq_title()+"',";
//						项目经理
						tmp_content=tmp_content+"'"+test_bill.getTest_technical_director()+"',";
//						测试结论
						tmp_content=tmp_content+"'',";
//						测试组织人
						tmp_content=tmp_content+"'',";
//						测试概况
						tmp_content=tmp_content+"'',";
//						严重及以上级别缺陷
						tmp_content=tmp_content+"'',";
//						一般缺陷
						tmp_content=tmp_content+"'',";
//						其他级别缺陷
						tmp_content=tmp_content+"'',";
//						关联交易/功能
						tmp_content=tmp_content+"'',";
//						渠道
						tmp_content=tmp_content+"'',";
//						类型
						tmp_content=tmp_content+"'',";
//						案例覆盖
						tmp_content=tmp_content+"'',";						
//						其他说明
						tmp_content=tmp_content+"'',";
//						上线申请
						tmp_content=tmp_content+"'',";
//						上线申请人
						tmp_content=tmp_content+"'',";
//						上线步骤
						tmp_content=tmp_content+"'',";
//						应急预案
						tmp_content=tmp_content+"'',";
//						跟踪事项/目的
						tmp_content=tmp_content+"'',";
//						跟踪时间
						tmp_content=tmp_content+"'',";
//						跟踪人
						tmp_content=tmp_content+"'',";
//						注意事项
						tmp_content=tmp_content+"''";
						
						tmp_content=tmp_start+tmp_content+tmp_end;		
						r_content=r_content+tmp_content;
					}
						
				}
				return r_start+r_content+r_end;
		}else{
			return "";
		}
		
	}

	@RequestMapping(value = "/test_trace_grid", method = { RequestMethod.GET })
	public String req_trace_grid(HttpServletRequest request) {
		logger.info("access /test/test_trace_grid");		
	
		String s_tmp=trans_2_json_test_trace_grid();
		logger.info("test_trace_grid :" + s_tmp);
		return s_tmp;	
		
	}


	private String trans_2_json_test_trace_grid() {
		List<Test_bill> all_test_list=test_bill_Service.search_all_test();
		if(all_test_list!=null){
				String r_start="{rows:[";		
				String r_end="]}";
				String r_content="";
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
				int count_value=0;
				for (Test_bill test_bill : all_test_list) {
					String req_id=String.valueOf(test_bill.getReq_id());
					Req_bill req_bill=req_bill_Service.req_bill_search_by_id(req_id);
					Req_base_info req_base_info=req_bill_Service.search_req_base_info(req_id);
					count_value=count_value+1;
					String tmp_start="{ id:"+(count_value)+",data:[";
					String tmp_end="]}";
					String tmp_content="";
					if(count_value < all_test_list.size()){
						tmp_end=tmp_end+",";
					}
										
					//ID
					tmp_content="'"+test_bill.getId()+"',";  
					//String tmp_content="";
					//项目主题
					tmp_content=tmp_content+"'"+req_bill.getReq_title()+"',";

					Test_base_info test_base_inf= test_bill_Service.search_a_test_base_info_by_testid(String.valueOf(test_bill.getId()));
					if (test_base_inf != null) {
						//已分配 已完成 状态
						//填报人
						String str_reporter="";
						String str_role="";
						String status1="已接收";
						String status2="已分配";
						String status3="已完成";
						String get_test_status=test_bill.getTest_status();
						if(get_test_status.equals(status1)){
							//业务方案管理中心负责人
							str_reporter=userService.find_project_manager();
							str_role="负责人";
						}
						if(get_test_status.equals(status2)||get_test_status.equals(status3)){
							///需求负责人、需求分析人、需求监理人
							str_reporter=test_base_inf.getTest_head()+"/"+test_base_inf.getTest_executor();
							str_role="测试负责人/测试实施人";
						}
						tmp_content=tmp_content+"'"+str_reporter+"',";
						//项目角色
						tmp_content=tmp_content+"'"+str_role+"',";
						//Req_workload_info obj=req_bill_Service.search_a_req_workload_info(req_id,s_array[i],role);
						//类型
						tmp_content=tmp_content+"'"+test_base_inf.getTest_difficult()+"',";
						//领取时间
						String date_tmp="";
						
							if (test_base_inf.getCreate_time()!=null) {								
								date_tmp= sdf2.format(test_base_inf.getCreate_time());	
							} 
					
						
						tmp_content=tmp_content+"'"+date_tmp+"',";
						//成员 
						tmp_content=tmp_content+"'"+test_base_inf.getTest_executor()+"',";
						//监理
						tmp_content=tmp_content+"'',";
						//技术负责人
						tmp_content=tmp_content+"'"+test_bill.getTest_technical_director()+"',";
						//项目状态
						String tmp_status="5应用测试";
						String status_value1="已完成";
						
						if(get_test_status.equals(status_value1)){
							tmp_status="6完成测试";
						}
						tmp_content=tmp_content+"'"+tmp_status+"',";
						//项目节点
						tmp_content=tmp_content+"'"+test_base_inf.getNode_value()+"',";
						//项目日志/周报
						 List<Test_work_log> log_list=test_bill_Service.search_test_work_log(String.valueOf(test_bill.getId()));
						 String log_tmp="'";
						 if(log_list!=null){
							for (Test_work_log req_work_log : log_list) {
								if (log_tmp.length()<2) {
									log_tmp=log_tmp+sdf2.format(req_work_log.getWork_date())+" "+req_work_log.getUser_name()+"  "+req_work_log.getWork_log();
								} else {
									log_tmp=log_tmp+"<br>"+sdf2.format(req_work_log.getWork_date())+" "+req_work_log.getUser_name()+"  "+req_work_log.getWork_log();
								}
								
							} 
						 }
						tmp_content=tmp_content+log_tmp+"'";
						tmp_content=tmp_start+tmp_content+tmp_end;		
						r_content=r_content+tmp_content;
					}else{
						//已接收，未分配状态时
						String str_reporter="";
						String str_role="";
						
						str_reporter=userService.find_project_manager();
						
						str_role="负责人";
						
						tmp_content=tmp_content+"'"+str_reporter+"',";
						//项目角色
						tmp_content=tmp_content+"'"+str_role+"',";
						//Req_workload_info obj=req_bill_Service.search_a_req_workload_info(req_id,s_array[i],role);
						//类型
						tmp_content=tmp_content+"'',";
						//领取时间
						String date_tmp="";
					
							if (test_bill.getCreate_date()!=null) {								
								date_tmp= sdf2.format(test_bill.getCreate_date());	
							}
						
						
						tmp_content=tmp_content+"'"+date_tmp+"',";
						//成员 
						tmp_content=tmp_content+"'无',";
						//监理
						tmp_content=tmp_content+"'无',";
						//技术负责人
						tmp_content=tmp_content+"'无',";
						//项目状态												
						tmp_content=tmp_content+"'5应用测试',";
						//项目节点
						tmp_content=tmp_content+"'5应用测试',";
						//项目日志/周报
						tmp_content=tmp_content+"'',";
						tmp_content=tmp_start+tmp_content+tmp_end;		
						r_content=r_content+tmp_content;
					}
						
				}
				return r_start+r_content+r_end;
		}else{
			return "";
		}
	}	
	
	private Map<String, Object> trans_json_value(Map<String, Object> map){
		String return_v="";
		String tmp_content="";
		
		int count_value=(int)map.get("count_value");
		String req_id=(String)map.get("req_id");
		String input_value=(String)map.get("input_value");
		//Req_base_info req_base_info=(Req_base_info)map.get("req_base_info");
		String role=(String)map.get("role");
		if (input_value==null||input_value.equals("")) {
			tmp_content="";
		} else {
			String[] s_array=input_value.split(",");
			for (int i = 0; i < s_array.length; i++) {				
					String tmp_start="{ id:"+(count_value)+",data:[";
					String tmp_end="]}";
					if((i+1)<s_array.length){
						tmp_end=tmp_end+",";
					}
					
					//ID
					tmp_content="'"+count_value+"',";  
					//String tmp_content="";
					//name
					tmp_content=tmp_content+"'"+s_array[i]+"',";
					//角色
					tmp_content=tmp_content+"'"+role+"',";
					//计划完成日	
					Req_workload_info obj=req_bill_Service.search_a_req_workload_info(req_id,s_array[i],role);
					SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
					if(obj==null){
						//计划完成日	
						tmp_content=tmp_content+"'',";
						//实际完成日
						tmp_content=tmp_content+"'',";	
						//计划工作量
						tmp_content=tmp_content+"'',";	
						//实际工作量
						tmp_content=tmp_content+"''";							
					}else{
											
						//计划完成日	
						String date_tmp="";
						if (obj.getPlan_complete_date()!=null) {
							date_tmp= sdf.format(obj.getPlan_complete_date());	
						} 
						tmp_content=tmp_content+"'"+date_tmp+"',";
						//实际完成日
						if (obj.getActual_complete_date()!=null) {
							date_tmp= sdf.format(obj.getActual_complete_date());	
						} 		
							
						tmp_content=tmp_content+"'"+date_tmp+"',";
						//计划工作量
						//if (obj.getPlan_workload()==null) {
						//	tmp_content=tmp_content+"'0',";
						//} else {
							tmp_content=tmp_content+"'"+obj.getPlan_workload()+"',";
						//}
						
						//实际工作量
						//if (obj.getActual_workload()==null) {
						//	tmp_content=tmp_content+"'0'";
						//} else {
							tmp_content=tmp_content+"'"+obj.getActual_workload()+"'";
						//}						
					}												
					tmp_content=tmp_start+tmp_content+tmp_end;		
					return_v=return_v+tmp_content;
					count_value=count_value+1;
			}
		}
		//return_v=tmp_content;
		Map<String, Object> map_r = new HashMap<String, Object>();
		map_r.put("json_value", return_v);
		map_r.put("count_value", count_value);				
		return map_r;
		
	}
}
